﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Reflection;

namespace QL_Truong_Hoc
{
    public partial class frmChonMonVanHoa : DevExpress.XtraEditors.XtraForm
    {
        public bool Selected { get; set; }
        public int MonID { get; set; }

        public frmChonMonVanHoa()
        {
            InitializeComponent();
        }

        private void frmChonKhungDaoTao_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'qLTHDataSet.mMonVanHoa' table. You can move, or remove it, as needed.
            this.mMonVanHoaTableAdapter.Fill(this.qLTHDataSet.mMonVanHoa);
            
            this.Selected = false;
        }

        private void btnChoose_Click(object sender, EventArgs e)
        {
            try
            {
                //lấy dữ liệu
                this.MonID = clsCommon.fncCnvNullToInt(dgvKhung.GetFocusedRowCellValue(colMVH_ID));

                if (this.MonID <= 0)
                {
                    clsCommon.fncMsgInfo("Hãy chọn một môn học.");
                    dgvKhung.Focus();
                    return;
                }
                
                this.Selected = true;

                this.Close();
            }
            catch (Exception ex) { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {               
                this.Close();
            }
            catch (Exception ex) { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
        }
    }
}